function AsStringDecoder() {
	function urldecode(str) {
		return decodeURIComponent(str);
	}
	
	this.decode = function(t, enc) {
		var str = urldecode(enc);

		if(t.equals(Types.UNKNOWN)) {
			var ret = null;
			eval("ret = " + str);
			return ret;			
		}

		if(t.equals(Types.STRING)) {
			if(str == Types.EMPTY_STRING_TOKEN) return "";
			if(str == Types.NULL_TOKEN)         return null;

			return str;
		}
		
		if(t.equalsAny([Types.INT, Types.LONG, Types.SHORT, Types.BYTE])) return parseInt(str);
		if(t.equals(Types.BOOLEAN))	                                      return str == "true";
		if(t.equalsAny([Types.DOUBLE, Types.FLOAT]))                      return parseFloat(str);
		if(t.equals(Types.CHAR))                                          return str;
		

		return str;
	}
	
	this.isDecodeable = function(t) {
		return t.equalsAny([Types.UNKNOWN, Types.STRING, Types.INT, Types.LONG, Types.SHORT, 
				Types.BOOLEAN, Types.DOUBLE, Types.FLOAT, Types.BYTE, Types.CHAR]);
	}

}
